Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change toLower to toLowerANSI #410

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

change toLower to toLowerANSI #410

wants to merge 2 commits into from

Conversation

jokoho48
Copy link
Collaborator

When merged this pull request will:

  1. Title

@jokoho48 jokoho48 requested review from diwako and nk3nny August 25, 2024 12:25
@jokoho48 jokoho48 self-assigned this Aug 25, 2024
@diwako
Copy link
Collaborator

diwako commented Aug 25, 2024

Huh? Why?

@jokoho48
Copy link
Collaborator Author

jokoho48 commented Aug 25, 2024

its faster than toLower because it only expects characters up to 255

https://community.bistudio.com/wiki/toLowerANSI

Converts the supplied string to all lower case characters fast (could be 3× faster than toLower).

@@ -11,7 +11,7 @@ GVAR(CalloutCacheNamespace) = call CBA_fnc_createNamespace;
if !(".p3d" in _string) then {
_string = _string + ".p3d";
};
GVAR(blockSuppressionModelCache) setVariable [toLower _string, true];
GVAR(blockSuppressionModelCache) setVariable [toLowerANSI _string, true];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we probably should not do that, in case there is someone using none standard ANSI characters for the file path.

Copy link
Collaborator Author

@jokoho48 jokoho48 Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember, setVariable only supports ASCII characters as Variable names. So that should not be an issue

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private _yeet = false call CBA_fnc_createNamespace; 
private _string = "\правда\model.p3d"; 
if ((_string select [0,1]) isEqualTo "\") then { 
 _string = [_string, 1] call CBA_fnc_substr; 
}; 
if !(".p3d" in _string) then { 
 _string = _string + ".p3d"; 
}; 
_yeet setVariable [toLowerANSI _string, true]; 
allVariables _yeet

returns ["������������\model.p3d"]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that means obfuscated pbos will not work well here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants